import Vue from 'vue'
import VueRouter from 'vue-router'

import Login from '@/components/Login'
import Register from '@/components/Register'
import Front from '@/components/Front'
import Home from '@/components/front/Home'
import Person from '@/components/front/Person'
import NewBlog from '@/components/front/NewBlog'
import Blog from '@/components/Blog/Blog.vue'
import Questions from "@/components/Blog/Questions.vue";
import UserPage from '@/components/front/UserPage.vue'
import AI from '@/components/front/AI.vue'

import Main from '@/views/Main.vue'
import home from '@/views/home.vue'
import user from '@/views/user.vue'
import tie from '@/views/tie.vue'
import comment from '@/views/comment.vue'
import reply from '@/views/reply.vue'
import Question from "@/components/front/Question.vue";
import Answer from "@/components/front/Answer.vue";

Vue.use(VueRouter)

const routes = [
  { path: '/', redirect: '/login' },
  { path: '/login', name: 'Login', component: Login },
  { path: '/register', name: 'Register', component: Register },
  {
    path: '/front',
    name: 'Front', 
    component: Front,  
    children:[
      { path: '', name: 'Home', component: Home },
      { path: 'home', name: 'FHome', component: Home },
      { path: 'question', name: 'question', component: Question},
      { path: 'answer', name: 'answer', component: Answer},
      { path: 'person', name: 'Person', component: Person},
      { path: 'ai', name: 'AI', component: AI},
      { path: 'newBlog', name: 'NewBlog', component: NewBlog},
      { path: 'blog/:tid', name: 'Blog', component: Blog},
      { path: 'questions/:qid', name: 'Questions', component: Questions},
      { path: 'user/:uid', name: 'User', component: UserPage},
    ]
  },
  {
    path: "/main",
    name: "Main",
    redirect: "/home",
    component: Main,
    children: [
      { path: "/home", name: "home", component: home },
      { path: "/user", name: "user", component: user },
      { path: "/tie", name: "tie", component: tie },
      { path: "/comment", name: "comment", component: comment },
      { path: "/reply", name: "reply", component: reply },
    ],
  },
]

const router = new VueRouter({
  routes
})

export default router